package com.imy.luascript;

import android.content.Context;

import androidx.multidex.MultiDexApplication;

import com.imy.accessibility.CoreService;
import com.imy.common.CommonLib;
import com.imy.common.util.ALog;
import com.imy.common.util.AppUtils;
import com.imy.lua.LuaCore;


public class App extends MultiDexApplication {
    public static volatile App mApp;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        mApp = this;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        //获取进程名
        String processName = AppUtils.getProcessName(this);
        String packageName = getPackageName();
        ALog.i(" processName:" + processName + " packageName:" + packageName);

        if (processName != null && !processName.equals(packageName)) {
            return;
        }
        CommonLib.init(this);
        initLua();
        ALog.i("app onCreate:"+CoreService.mService);

    }


    private void initLua() {
        LuaCore.get().init(this);
    }

    public static App getApp() {
        return mApp;
    }


}
